USE [NGroup_VTL_DB]
GO

ALTER TABLE [dbo].[Orders] DROP CONSTRAINT [FK_Orders_Products]
GO

/****** Object:  Table [dbo].[Orders]    Script Date: 4/19/2014 10:49:24 PM ******/
DROP TABLE [dbo].[Orders]
GO

/****** Object:  Table [dbo].[Orders]    Script Date: 4/19/2014 10:49:24 PM ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[Orders](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[ProductID] [int] NOT NULL,
	[ProductSupTypeID] [int] NOT NULL,
	[ProductTypeID] [int] NOT NULL,
	[CustomerName] [nvarchar](200) NULL,
	[CustomerPhone] [char](15) NULL,
	[ShippingAddress] [nvarchar](1000) NULL,
	[OrderDate] [datetime] NULL,
	[Amount] [int] NOT NULL,
	[TotalPrice] [float] NULL,
	[IsActive] [bit] NULL,
 CONSTRAINT [PK_Orders] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

ALTER TABLE [dbo].[Orders]  WITH CHECK ADD  CONSTRAINT [FK_Orders_Products] FOREIGN KEY([ProductID])
REFERENCES [dbo].[Products] ([ID])
GO

ALTER TABLE [dbo].[Orders] CHECK CONSTRAINT [FK_Orders_Products]
GO


